/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N050;
import queenb.net.entitybean.N050;
import queenb.net.entitybean.N050;
import queenb.web.util.PackageContants;

/**
 *
 * @author Hung.Ngo
 */
public class N050Store extends N050{
     public int updateN050(int pnPN050, int pnFH000, int pnFH200,String pvNV051, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_N050, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN050),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                         new Param(OracleTypes.CHAR, pvNV051),
                        new Param(OracleTypes.CHAR, pvLOGIN)});

           return super.update(updateStatement, N050.class);
        } catch (SQLException ex) {
            Logger.getLogger(N050Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
     
     public List<N050> getListN050(int pnFH000, int pnFH200, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N050, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, N050.class);
    }
     
      public List<N050> findAllN050ForCombo(int pnFH000, int pnFH200,String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_N050, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, N050.class);
        } catch (SQLException ex) {
            Logger.getLogger(N050Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N050Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N050Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
